import os

def get_dir(paths='', level=1):
    if level == 1:
        paths = input("请输入绝对路径:")
        print(paths)
    dirs = os.listdir(paths)
    for dir in dirs:
        allFile = os.path.join(paths, dir)
        if os.path.isdir(allFile):
            print("\t"*level+"|"+"--"*level, dir)
            get_dir(allFile, level+1)
        elif os.path.isfile(allFile):
            print("\t"*level+"|"+"--"*level, dir)


if __name__ == '__main__':
    get_dir()

